package com.fqgj.report.statistics.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.fqgj.report.statistics.dao.BiGpsStatDao;
import com.fqgj.report.statistics.entity.RiskBiGpsStatEntity;
import com.fqgj.report.statistics.entity.BiGpsStatEntity;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
* User: liupengpeng
* Date: 2017-10-23
* Time: 16:57:50.177
*/

@Repository
public class BiGpsStatDaoImpl extends AbstractBaseMapper<BiGpsStatEntity> implements BiGpsStatDao {

    @Autowired
    @Qualifier("sqlSessionFactory2")
    private SqlSessionFactory sqlSessionFactory;

    @Override
    public List<RiskBiGpsStatEntity> selectGpsList(String source, Integer isNew,
                                                   String startDate, String endDate, Integer queryType) {
        Map<String, Object> param = new HashMap<>();
        param.put("source", source);
        param.put("startDate", startDate);
        param.put("endDate", endDate);
        param.put("isNew", isNew);
        param.put("queryType", queryType);
        SqlSession sqlSession = new SqlSessionTemplate(sqlSessionFactory);

        return sqlSession.selectList(getStatement("selectGpsList"), param);
    }
}